package com.cms.service.impl;

import com.cms.dao.ClientMapper;
import com.cms.entity.Client;
import com.cms.exception.DuplicateKeyException;
import com.cms.service.ClientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;

@Service
public class ClientServiceImpl implements ClientService {
    @Autowired
    private ClientMapper clientMapper;

    @Override
    public List<Client> findAll() {
        return clientMapper.findAll();
    }

    @Override
    public int insertClient(Client client) throws DuplicateKeyException {
        return clientMapper.insertClient(client);
    }

    @Override
    public int updateClient(HashMap<String, String> updateMap) throws DuplicateKeyException {
        return clientMapper.updateClient(updateMap);
    }

    @Override
    public int deleteClient(String id) {
        return clientMapper.deleteClient(id);
    }

    @Override
    public List<Client> findClientById(String id) {
        return clientMapper.findClientById(id);
    }

    @Override
    public List<Client> findClientByName(String name) {
        return clientMapper.findClientByName(name);
    }

    @Override
    public List<Client> findClientByTelephone(String telephone) {
        return clientMapper.findClientByTelephone(telephone);
    }

    @Override
    public List<Client> findClientByEmail(String email) {
        return clientMapper.findClientByEmail(email);
    }

    @Override
    public List<Client> findClientByType(String type) {
        return clientMapper.findClientByType(type);
    }
}
